package com.industriallogic.blackjack;

import java.util.ArrayList;
import java.util.List;

public class Player {

	protected List<Card> hand = new ArrayList<Card>();

	public int getNumCardsInHand() {
		return hand.size();
	}

	public int hit(Deck deck) {

		Card card = deck.popCard();

		hand.add(card);

		return calculateHand();
	}

	public int calculateHand() {
		int sum = 0;

		for (Card card : hand) {
			sum += card.getRank().getValue();
		}

		return sum;

	}


	protected void printCardsInHand() {

		System.out.print("PLAYER:  ");

		for (Card card : hand) {
			card.print();

		}
		System.out.println("");

	}

}
